package com.scqkxx.gamebox.activity.home.adapter;

import android.content.ContentValues;

import com.avos.avoscloud.AVObject;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.scqkxx.gamebox.R;
import com.scqkxx.gamebox.activity.activities.utils.ActivityUtil;
import com.scqkxx.gamebox.activity.game.adapter.GameGridAdapter;
import com.scqkxx.gamebox.activity.myself.MyselfEditNicknameActivity;
import com.scqkxx.gamebox.common.Const;

import org.greenrobot.eventbus.EventBus;

import java.util.List;

/**
 * Created by admin on 2018/8/15. 09点37分
 * name: 唐师
 * 用途 ： 游戏页面的适配器
 */

public class NavPositionAdapter extends BaseQuickAdapter<AVObject, BaseViewHolder> {

    public NavPositionAdapter(int layoutResId, List<AVObject> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, AVObject item) {
        helper.setText(R.id.tv_nav_item_name, "#  " + item.getString("name"));

        helper.convertView.setOnClickListener(view -> {
            ContentValues contentValues = new ContentValues();
            contentValues.put("spaceState" ,1);
            contentValues.put("belongGroupId",item.getInt("belongGroupId"));
            contentValues.put("objectId",item.getInt("spaceId")+"");
            contentValues.put("spaceId",item.getInt("spaceId"));
            ActivityUtil.switchTo(mContext,MyselfEditNicknameActivity.class,contentValues);
            EventBus.getDefault().post(Const.CLOSE_NAV);
        });
    }
}
